<?php


namespace App\Http\Repositories\ProductCenter;


use App\Http\Repositories\BaseRepository;
use App\Models\ProductCenter\Models\ShopModel;

class ShopRepository extends BaseRepository
{
    public $shop;
    public function __construct(ShopModel $shop)
    {
        $this->shop = $shop;
    }

    public function getShopInfo($data)
    {
        $where['id'] = $data['id'];
        return $this->shop->getInfo($where);
    }

    public function getShopList($data)
    {
        $where = [];
        is_real_exists(@$data['name']) && $where['name'] = ['like', '%'.$data['name'].'%'];
        is_real_exists(@$data['status']) && $where['status'] = $data['status'];

        return $this->shop->getListByPage($where);

    }

    public function addShop($data)
    {
        return $this->shop->addItem($data, true);
    }

    public function editShop($data)
    {
        $where['id'] = $data['id'];

        $this->shop->editItem($where, $data);

        return [];
    }

    public function delShop($data)
    {
        return $this->shop->deleteItem($data);
    }
}
